<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>sort</title>
		
		<script type="text/javascript">
			function doBubbleSort(psForm){
				alert(psForm);
				alert(psForm.input);
				psFormpsFormalert(psForm.input.text);
				var tmp = new Array();
				for ( var i = 0; i < tmp.length; i++) {
					tmp.push(psForm.text[i].value);
				}
				
				var sortComplete = tmp;
				
				for ( var i = sortComplete.length; i  > 0; i++) {
					for ( var j = 0; j < sortComplete.length; j++) {
						if(j + 1 > i - 1){ break; }
						if(sortComplete[j] > sortComplete[j + 1]){
							var tmpNum = sortComplete[j];
							sortComplete[j] = sortComplete[j+1];
							sortComplete[j+1] = tmpNum;
						}
					}
				}
				
				var vsTmpSorting = "";
				
				for ( var i = 0; i < sortComplete.length; i++) {
					vsTmpSorting += tmpNum[i] + " / ";
				}
				alert(vsTmpSorting);
			}
		</script>
	</head>
	<body>
		<form id="exFrom">
			<input type="text" id="intArray" value="" />
			<input type="text" id="intArray" value="" />
			<input type="text" id="intArray" value="" />
			<input type="text" id="intArray" value="" />
			<input type="text" id="intArray" value="" />
			<input type="text" id="intArray" value="" />
			<input type="text" id="intArray" value="" />
			<input type="text" id="intArray" value="" />
			<input type="text" id="intArray" value="" />
			<input type="text" id="intArray" value="" />
			
			<input type="button" id="bubSort" value="버블정렬" onclick="doBubbleSort(this.form)" />
		</form>
	</body>
</html>